<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<%@include file="/include/style.jsp"%>
<%@include file="/include/script.jsp"%>
<script type="text/javascript" src="/js/page/profile.js?v=<%=Constants.VERSION %>"></script>
</head>
<body ng-controller="ProfileCtrl">
<legend>个人信息</legend>
<table cellspacing="0" cellpadding="0" border="0" class="form-table" style="font-size: 120%;">
	<tr height="40">
		<th width="100">用户名：</th>
		<td>
			<span ng-bind="user.username"></span>
			<a href="#" ng-click="mode = 'changePwd'; confirmPwd = ''" ng-show="mode != 'editEmail' && mode != 'changePwd'">修改密码</a>
		</td>
	</tr>
	<tr height="40">
		<th>角色：</th>
		<td ng-bind="user.roleName"></td>
	</tr>
	<tr height="40" ng-show="user.type == 'Provider'">
		<th>终端厂商：</th>
		<td ng-bind="user.Provider.name"></td>
	</tr>
	<tr height="40">
		<th>联系邮箱：</th>
		<td>
			<span ng-show="mode != 'editEmail'">
				{{user.email}}
				<a href="#" ng-click="mode = 'editEmail'" ng-show="mode != 'editEmail' && mode != 'changePwd'">修改</a>
			</span>
			<span ng-show="mode == 'editEmail'">
				<input type="text" ng-model="email" ng-change="validateEmail()" style="width: 250px;"/>
			</span>
			<span class="text-danger" ng-bind="errorMessage.email"></span>
		</td>
	</tr>
	<tr height="40" ng-show="mode == 'changePwd'">
		<th>密码：</th>
		<td>
			<input type="password" ng-model="user.password" placeholder="长度6-24位" maxlength="24" ng-change="validatePassword()" style="width: 250px;" />
			<span class="text-danger" ng-bind="errorMessage.password"></span>
		</td>
	</tr>
	<tr height="40" ng-show="mode == 'changePwd'">
		<th>确认密码：</th>
		<td>
			<input type="password" ng-model="confirmPwd" placeholder="与密码一致" ng-change="validateConfirmPwd()" maxlength="24" style="width: 250px;" />
			<span class="text-danger" ng-bind="errorMessage.confirmPwd"></span>
		</td>
	</tr>
	<tr height="40" ng-show="mode == 'editEmail' || mode == 'changePwd'">
		<th>&nbsp</th>
		<td>
			<button class="btn btn-primary" ng-click="save();"> 保 存 </button>
			<button class="btn btn-default" ng-click="cancel()"> 取消 </button>
		</td>
	</tr>
</table>
</body>
</html>